Skip to main content

dragStart

Type

message

Summary

Sent to a control when the user clicked on it and then started to drag the mouse pointer.

Syntax

dragStart

Description

The dragStart message is sent to a control when the user clicks on it and then drags the mouse pointer at least dragDelta pixels from its original position.

Use this handler to initiate a drag-drop operation if required. An operation can be initiated by setting a data-type of the dragData property.

LiveCode automatically handles the mechanics of dragging and dropping text between and within unlocked fields. To support this type of drag and drop operation, you don't need to do any scripting: the drag begins automatically when LiveCode receives the dragStart message.

If you don't want to allow dragging text from a particular field, you should place a dragStart handler in the field that does not contain a pass control structure:

    on dragStart -- in script of field or one of its owners
-- do nothing, but trap the message

end dragStart

Examples

on dragStart -- in a field script
-- color the text that's being dragged:
set the textColor of the selectedChunk to "#333399"
pass dragStart
end dragStart

glossary: control structure, handler, message

message: dragEnter

property: dragData, dragImageOffset, dragAction, dragDelta

command: click

control structure: pass

Compatibility and Support

Introduced

LiveCode 2.0

OS

mac

windows

linux

Platforms

desktop

server

Thank you for your feedback!

Was this page helpful?